package com.allwees.core.common.util.encrypt;

/**
 * MD5摘要算法
 * linux系统不一致
 * @author yangylsky
 */
@Deprecated
public class Md5 extends Encryptor {
	public static String crypt(String str) {
		if(str == null || str.length() == 0) {
			throw new IllegalArgumentException("String to encript cannot be null or zero length");
		}

		byte[] hash = encryptMD5(str.getBytes());
		StringBuilder hexString = new StringBuilder();
		for(byte element : hash) {
			if((0xff & element) < 0x10) {
				hexString.append("0").append(Integer.toHexString((0xFF & element)));
			} else {
				hexString.append(Integer.toHexString(0xFF & element));
			}
		}

		return hexString.toString();
	}
}
